﻿<KCtl:BaseUserControl x:Class="Kiva7.Pages.LendersControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:KCtl="clr-namespace:Kiva7.Controls"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480"
    KCtl:TiltEffect.IsTiltEnabled="True">

    <Grid>

        <ProgressBar Visibility="{Binding IsLoaded, Converter={StaticResource booleanToNotVisibility}}" 
                     IsIndeterminate="{Binding IsLoaded, Converter={StaticResource notBooleanConverter}}" 
                     Style="{StaticResource CustomIndeterminateProgressBar}"
                     VerticalAlignment="Center" />


        <ListBox x:Name="lbxLenders" Margin="0,0,-12,0" ItemsSource="{Binding Data}" 
              Background="{StaticResource KivaBackgroundBrush}"
             HorizontalContentAlignment="Stretch" SelectionChanged="lbxLenders_SelectionChanged"
             Visibility="{Binding IsLoaded, Converter={StaticResource booleanToVisibility}}">

            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="12,0,0,18">
                        <StackPanel Style="{StaticResource KivaListItemImageStyle}">
                            <KCtl:KivaImageControl x:Name="imgLender" ImageSize="Small" ImageData="{Binding Image}" 
                               Width="78" Height="78" Margin="0,12,0,0"
                            Visibility="{Binding Image, Converter={StaticResource objectVisibility}}" VerticalAlignment="Top" />
                        </StackPanel>
                        <KCtl:OrientedStackPanel Orientation="Vertical" WidthP="364" WidthL="526" Margin="6,0,0,0" Style="{StaticResource KivaListItemStyle}" >

                            <TextBlock Text="{Binding Name}" TextWrapping="Wrap" 
                               Style="{StaticResource KivaTextGroupHeaderStyle}" />

                            <TextBlock Text="{Binding WhereAbouts}" TextWrapping="Wrap" 
                               Style="{StaticResource KivaTextNormalStyle}" />

                        </KCtl:OrientedStackPanel>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <ProgressBar Maximum="{Binding PagesCount}" Value="{Binding PagesLoaded}" VerticalAlignment="Top" Height="10" 
                     Visibility="{Binding PagesLoading, Converter={StaticResource booleanToVisibility}}"/>

    </Grid>
</KCtl:BaseUserControl>
